<div class="row">
    <div class="col-md-12 active-filters">
        <h4>Filters</h4>
        <form ng-submit="search()">
            <div class="row mb-xxxs" ng-repeat="filter in filtering.context.filters track by $index">
                <div class="col-sm-4 col-md-4 col-lg-2">
                    <div class="input-group">
                        <span class="input-group-btn">
                            <button class="btn btn-default" type="button" ng-click="removeFilter($index)">
                                <i class="fa fa-times text-danger"></i>
                            </button>
                        </span>
                        <select class="form-control" ng-model="filter.field"
                            ng-options="item for item in filtering.attributeKeys"
                            ng-change="filtering.setFilterField(filter, config.entity)"></select>
                    </div>
                </div>
                <div class="col-sm-8 col-md-8 col-lg-6">
                    <filter-editor metadata="filtering.metadata" filter="filter" entity="filtering.entity"></filter-editor>
                </div>
            </div>
            <div class="mv-xs row">
                <div class="col-sm-12 col-md-12 col-lg-8">
                    <a href class="btn btn-sm  btn-link btn-clear" ng-click="filtering.addFilter()">
                        <i class="fa fa-plus"></i> Add a filter
                    </a>
                    <a href class="btn btn-sm btn-danger" ng-click="clearFilters()" ng-if="filtering.context.filters.length > 0">
                        <i class="fa fa-times"></i> Clear
                    </a>
                    <button href class="btn btn-sm btn-primary pull-right" type="submit" ng-if="filtering.context.filters.length > 0">
                        <i class="fa fa-search"></i> Search
                    </button>
                </div>
            </div>
        </form>


        <!-- <form class="form-horizontal" name="filtersForm" ng-submit="filter(filtersForm);" novalidate>

            <div class="row">
                <div class="col-md-12">
                    <div class="form-group mb-0">
                        <label class="col-sm-2 control-label">Keyword</label>
                        <div class="col-sm-10">
                            <input class="form-control" ng-model="uiSrv.activeFilters.keyword.value" placeholder="ex: freetext"></input>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-md-12">
                    <div class="col-sm-10 col-sm-offset-2">
                        <hr class="filter-separator" />
                    </div>
                </div>
            </div>



            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">Type</label>
                        <div class="col-sm-8">
                            <tags-input class="form-control form-control-wrapper" min-length="2" ng-model="uiSrv.activeFilters.dataType.value" placeholder="ex: ip, domain, url" replace-spaces-with-dashes="false"></tags-input>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">Tags</label>
                        <div class="col-sm-8">
                            <tags-input class="form-control form-control-wrapper" min-length="2" ng-model="uiSrv.activeFilters.tags.value" placeholder="ex: misp, malspam, ioc" replace-spaces-with-dashes="false"></tags-input>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">Value</label>
                        <div class="col-sm-8">
                            <input class="form-control" ng-model="uiSrv.activeFilters.data.value" placeholder="ex: example.com, 8.8.8.8"></input>
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">Date</label>
                        <div class="col-sm-8">
                            <div class="row">
                                <div class="col-sm-6">
                                    <dt-picker date="uiSrv.activeFilters.startDate.value.from" placeholder="from"></dt-picker>
                                </div>
                                <div class="col-sm-6">
                                    <dt-picker date="uiSrv.activeFilters.startDate.value.to" placeholder="to"></dt-picker>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">Flags</label>
                        <div class="col-sm-8">
                            <div class="mr-xxs mb-xxxs btn-group">
                                <label uib-btn-radio="true" class="btn btn-default btn-sm" name="ioc" ng-model="uiSrv.activeFilters.ioc.value">IOC</label>
                                <label uib-btn-radio="false" class="btn btn-default btn-sm" name="ioc" ng-model="uiSrv.activeFilters.ioc.value">Not IOC</label>
                                <label uib-btn-radio="null" class="btn btn-default btn-sm" name="ioc" ng-model="uiSrv.activeFilters.ioc.value">Any</label>
                            </div>

                            <div class="btn-group">
                                <label uib-btn-radio="true" class="btn btn-default btn-sm" name="sighted" ng-model="uiSrv.activeFilters.sighted.value">Sighted</label>
                                <label uib-btn-radio="false" class="btn btn-default btn-sm" name="sighted" ng-model="uiSrv.activeFilters.sighted.value">Not sighted</label>
                                <label uib-btn-radio="null" class="btn btn-default btn-sm" name="sighted" ng-model="uiSrv.activeFilters.sighted.value">Any</label>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">Description</label>
                        <div class="col-sm-8">
                            <input class="form-control" ng-model="uiSrv.activeFilters.message.value" placeholder="ex: freetext"></input>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pull-right">
                <button class="btn btn-sm btn-primary" type="submit">Apply filters</button>
            </div>
        </form> -->

    </div>
</div>
